#region Using directives

using System;
using FighterChessEngine.Enum;
using FighterChessEngine.FC_Board;

#endregion

namespace FighterChessEngine.FC_Fighter.Fighters
{
    /// <summary>
    /// Summary description for Pawn.
    /// </summary>
    public class Pawn : Fighter
    {
        #region Atributes
        #endregion

        #region Properties
        #endregion

        #region Methods
        public Pawn() : base()
        {
            Init();
            level = 1;
        }

        public Pawn(Owner owner, Square pos) : base(owner, pos)
        {
            Init();
            level = 1;
        }

        public Pawn(string strPawn)
            : base(strPawn)
        {
            Init();
        }

        private void Init()
        {
            name = "Pawn";
            symbol = "P";
            type = FighterType.Pawn;
        }

        public override void UpdateNextPositions(Fighter[,] fighters)
        {
            base.UpdateNextPositions(fighters);

            for (int row = currentPos.Row - 1; row <= currentPos.Row + 1; row++)
                for (int col = currentPos.Col - 1; col <= currentPos.Col + 1; col++)
                {   
                    // current pos
                    if (row == currentPos.Row && col == currentPos.Col)
                        continue;

                    int checkResult = CheckSquare(fighters, row, col);
                    // 4 diagonal squares
                    if (row != currentPos.Row && col != currentPos.Col && checkResult == 2)
                        arrNextPos.Add(new Square(row, col));

                    // 4 straight squares
                    if ((row == currentPos.Row || col == currentPos.Col) && checkResult == 0)
                        arrNextPos.Add(new Square(row, col));
                }
        }
        #endregion


    }
}
